/**
 * 
 */
package neptune.manager.completer;

import neptune.manager.model.topology.Link;
import neptune.manager.model.topology.Node;
import neptune.manager.model.topology.Topology;

/**
 * Classe di utilita' adoperata per gestire il completamento della topologia. Al
 * costruttore sono passati il {@link NodeCompleter} ed il {@link LinkCompleter}
 * necessari ad effettuare il completamento dei nodi e dei link della topologia.
 * 
 * @author Roberto Bifulco [info@RobertoBifulco.it] [RobertoBifulco.it]
 * 
 */
public class TopologyCompleter {

	private NodeCompleter nodeComp;
	private LinkCompleter linkComp;

	/**
	 * 
	 * @param nodeComp
	 * @param linkComp
	 */
	public TopologyCompleter(NodeCompleter nodeComp, LinkCompleter linkComp) {
		super();
		this.nodeComp = nodeComp;
		this.linkComp = linkComp;
	}

	/**
	 * Avvia il completamento della topologia
	 * 
	 * @param topology
	 * @throws CompleterException
	 */
	public void completeTopology(Topology topology) throws CompleterException {
		for (Node node : topology.getNodes()) {
			nodeComp.completeNode(node, topology);
		}
		for (Link link : topology.getLinks()) {
			linkComp.completeLink(link, topology);
		}
	}

}
